package com.hhxy.utils;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;

public class SqlSessionFactoryUtils {
    private static SqlSessionFactory sqlSF;

    static{
        String resource = "./mybatis-config.xml";
        InputStream is = null;
        try {
            is = Resources.getResourceAsStream(resource);
        } catch (IOException e) {
            e.printStackTrace();
        }
        sqlSF = new SqlSessionFactoryBuilder().build(is);
        System.out.println("我被执行了。。。");
    }
    public static SqlSessionFactory sqlSF(){
        return sqlSF;
    }

}
